<template>
    <div class="main" v-loading="loading">
        <div class="search">
            <el-input v-model="search" @change.native="onSearch()" placeholder="Enter to search" suffix-icon="el-icon-search" clearable />
        </div>
        <div class="list">
            <el-row :gutter="22">
                <el-col v-for="(item,index) in data" :span="6" v-bind:key="index">
                    <div class="item">
                        <el-card class="box-card" :body-style="cardStyle(index)" @mouseover.native="moveIn(index)" @mouseout.native="moveOut(index)">
                            <transition name="el-zoom-in-center" v-if="item.show">
                                <div class="transition-box text">{{item.title}}</div>
                            </transition>
                            <transition name="el-zoom-in-center" v-else>
                                <div class="transition-box btn-box">
                                    <el-button size="mini" class="fa fa-compass" @click="panel(item)"> 控制台</el-button>
                                    <el-button size="mini" class="fa fa-cog" @click="edit(item)"></el-button>
                                    <el-button size="mini" class="fa fa-trash" @click="onDel(item.ID,index)"></el-button>
                                </div>
                            </transition>
                        </el-card>
                    </div>
                </el-col>
                <el-col :span="6">
                    <div class="item create">
                        <el-card class="box-card" :body-style="lastCardStyle">
                            <div class="text" @click="addDir()"><i class="el-icon-circle-plus"></i> 新建</div>
                        </el-card>
                    </div>
                </el-col>
            </el-row>
        </div>
        <el-dialog title="添加文件夹" :visible.sync="dialogAdd" width="350px">
            <el-form ref="form" :model="addData" :rules="rules" label-width="0px">
                <el-form-item prop="title" label="" :rules="rules.title">
                    <el-input v-model="addData.title"></el-input>
                </el-form-item>
                <el-form-item label="">
                    <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容" v-model="addData.intro"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" size="medium" style="width:100%" @click="onAdd()">提交</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
        <el-drawer title="我嵌套了表格!" :visible.sync="drawerAdd" direction="rtl" size="500px">
            <div>123</div>
        </el-drawer>
    </div>
</template>

<script>
export default {
    data(){
        return {
            search:'',

            dialogDel:false,
            dialogAdd:false,

            drawerAdd: false,

            loading:false,

            addForm: {},
            colorSet:[
                '#409EFF',
                '#e03997',
                'orange',
                '#21ba45',
                '#F56C6C',
                '#6435c9',
            ],
            lastCardStyle:{
                padding: '15px',
                background: '#21ba45',
                color: '#fff',
                cursor: 'pointer',
                height: '20px'
            },
            data:[],
        }
    },
    created(){
        this.onLoad()
    },
    methods:{
        onLoad(){
            this.loading = true
            this.loading = false
        },
        addDir(){
            this.drawerAdd = true
        }
    }
}
</script>
<style lang="scss" scoped>
.main .search{
    width: 350px;
    margin: auto;
}
.main .list{
    padding: 30px 20px;
    width: 80%;
    margin: auto;
    min-width: 1150px;
}
.list .item{
    text-align: center;
    font-size: 13px;
    width: 85%;
    margin: 5px auto 15px;
}
.transition-box span:not(:first-child){
    margin-left: 10px;
}
.box-card{
    height: 50px;
}
.btn-box{
    margin-top: -4px;
}
</style>
